home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 1
/
Cream of the Crop 1.iso
/
UTILITY
/
TASEXAM6.ARJ
/
MARKET.TAS
< prev
next >
Wrap
Text File
|
1991-08-04
|
6KB
|
151 lines
{ MARKET.TAS
This script generates a market 'snapshot'. It will
calculate
-the McClellan Oscillator and the McClellan Summation
indicators.
-the ARMS Short Term Trading Index.
-the Elphick's Volume Oscillator
Calculate a McClellan Oscillator as follows
ADdiff = NYAD - NYDE;
MacOsc = MOV(ADdiff,19,'E')-MOV(ADdiff,39,'E')
Calculate EVO as
CVI = cumulative sum of (up vol-down vol)/total vol
EVO = (3 day EMA of CVI - 10 day EMA of CVI) * 100
Calculate Arms' Short Term Trading Index as
TRIN = (ADV ISSUES/DEC ISSUES)
------------------------
(ADV VOL/DEC VOL)
Calculate the 10 Day Open TRIN as
10dayTRIN = SUM(ADV ISSUES,10)/SUM(DEC ISSUES,10)
-------------------------------------
SUM(ADV VOL,10)/SUM(DEC VOL,10)
-----------------------------------------------------
To run this, you should have a ticker file containing
one of the following tickers and modify the variables
named below to be the names of the tickers containing
your advancing/declining issues, NYSE up/dn vol and
NYSE total volume.
It is important to note that ALL of the ticker files
must have the _SAME_ number of quotes, or you should
set #MAX_QUOTES to the _minimum_ number of quotes in
any of the ticker files used for indices.
NYADname - Advancing
NYDEname - and NYSE Declining issues
SPNUname - NYSE Up Volume
SPNDname - NYSE Down Volume
NYSEname - Composite
-----------------------------------------------------
}
MacSumBase = 310.005; { Set this to whatever starting value
you want to MacSum to start at}
CVIBase = 0; { and to adjust for the keeper of the EVO}
#index 'sp-500'
#output_file 'market.lst'
{
NOTE----------------------------------------------
Change the 5 symbol names in quotes below to
whatever symbols you use for the tickers shown
NOTE----------------------------------------------
}
NYADname = 'NYAD'; { Change to your NYSE Adv Issues ticker}
NYDEname = 'NYDE'; { Change to your NYSE Dec Issues ticker}
NYUPname = 'SPNU'; { Change to your NYSE UP Vol ticker}
NYDNname = 'SPND'; { Change to your NYSE DN Vol ticker}
NVOLname = 'NYSE'; { Change to your NYSE Total Volume}
GRAPH_IT = 0; { Set to 1 to see graphs}
NYAD : ARRAY; { advancing issues}
NYDE : ARRAY; { declining issues}
NYUP : ARRAY; { Up Vol}
NYDN : ARRAY; { Dn Vol}
NVOL : ARRAY; { Total Vol}
NYSE : ARRAY; { NYSE Comp}
VLdiff : ARRAY; { Up - Dn}
CVI : ARRAY; { Cum Vol Index}
EVO : ARRAY; { EVO goes here}
ADdiff : ARRAY; { advancing - declining}
MacOsc : ARRAY; { McClellan Oscillator goes here}
MacSum : ARRAY; { McClellan Summation goes here}
MacBaseArray : ARRAY; { array of Base value}
CVIBaseArray : ARRAY; { Mike Elphick's values}
TRIN : ARRAY;
TRINdays = 10; { 10 day open TRIN}
TRIN_AI : ARRAY; { 10 day advancing issues}
TRIN_DI : ARRAY; { 10 day declining issues}
TRIN_AV : ARRAY; { 10 day advancing vol}
TRIN_DV : ARRAY; { 10 day declining vol}
TRINma : ARRAY; { TRIN moving average}
NYAD = LOAD(NYADNAME,'C');
NYDE = LOAD(NYDENAME,'C');
NYUP = LOAD(NYUPNAME,'C');
NYDN = LOAD(NYDNNAME,'C');
NVOL = LOAD(NVOLname,'V');
NYSE = LOAD(NVOLname,'C');
{----------COMPUTATION HERE --------------}
if last_ticker = 0 then return;
{----- McClellan calculation-----}
ADdiff = SUB(NYAD,NYDE); { Adv - Dec}
MacOsc = SUB(MOV(ADdiff,19,'E'),MOV(ADdiff,39,'E')); {19ema-39ema}
SET(MacBaseArray,MacSumBase); { set array to constant value}
MacSum = CUM(MacOsc); { compute cumulative value}
MacSum = ADD(MacSum,MacBaseArray); { add the base offset for macsum}
{----- EVO calculation-----}
VLdiff = DIV(SUB(NYUP,NYDN),NVOL); { (UP - DN)/TOTAL}
CVI = CUM(VLdiff);
SET(CVIBaseArray,CVIBase); { set array to constant value}
CVI = ADD(CVI,CVIBaseArray);
EVO = SUB(MOV(CVI,3,'E'),MOV(CVI,10,'E')); {10ema-3ema}
EVO = MULBY(EVO,100); { EVO * 100}
{-----TRIN calculation-----}
TRIN = DIV(NYAD,NYDE);
TRIN = DIV(TRIN,DIV(NYUP,NYDN));
TRIN_AI = SUM(NYAD,TRINdays);
TRIN_DI = SUM(NYDE,TRINdays);
TRIN_AV = SUM(NYUP,TRINdays);
TRIN_DV = SUM(NYDN,TRINdays);
TRINma = DIV(TRIN_AI,TRIN_DI);
TRINma = DIV(TRINma,DIV(TRIN_AV,TRIN_DV));
{ now that all the values are calculated,
write them out}
WRITELN(
' TAS Market Summary for ',DATE);
WRITELN();
WRITELN(
' Today Yesterday',
' Change');
WRITELN('McClellan Oscillator ',MacOsc,' ',MacOsc[-1],
' ',MacOsc-MacOsc[-1]);
WRITELN('McClellan Summation ',MacSum,' ',MacSum[-1],
' ',MacSum-MacSum[-1]);
WRITELN('Elphicks Volume Oscillator(EVO) ',EVO, ' ',EVO[-1],
' ',EVO-EVO[-1]);
WRITELN('Cumulative Volume Index(CVI) ',CVI, ' ',CVI[-1],
' ',CVI-CVI[-1]);
WRITELN('Arms Short Term Index (TRIN) ',TRIN,' ',TRIN[-1],
' ',TRIN-TRIN[-1]);
WRITELN('Open-10 TRIN ',TRINma,' ',TRINma[-1],
' ',TRINma-TRINma[-1]);
if graph_it=0 then return;
OPENGRAPH(3); { Start 3 graphs}
GRAPH(INDEX,'SP-500 Index');
GRAPH(MacOsc,'McClellan Oscillator');
GRAPH(MacSum,'McClellan Summation');
CLOSEGRAPH();
{At this point, the EVO and CVI are computed and held in arrays
EVO and CVI. Let's graph them under NYSE Composite}
OPENGRAPH(3); { Start 3 graphs}
GRAPH(NYSE,'NYSE Composite');
GRAPH(CVI,'Cumulative Volume Index');
GRAPH(EVO,'Elphicks Volume Oscillator');
CLOSEGRAPH();
OPENGRAPH(2);
GRAPH(DJ30,'DOW 30');
GRAPH(TRIN,'ARMS INDEX',TRINma,'ARMS 10 DAY TRIN');
CLOSEGRAPH();